<template>
	<view>
		<view class="page">
		   <comp-common v-bind="{data:data}"></comp-common>
			<comp-header v-bind="{data:data}"></comp-header>
		    <view class="body after-navber">
		        <view class="top-bar flex-row">
		            <navigator :class="['flex-grow-1',data.status==0?'active':'']" openType="redirect" url="/lottery/prize/prize?status=0">
		                <text>进行中</text>
		            </navigator>
		            <navigator  :class="['flex-grow-1',data.status==2?'active':'']" openType="redirect" url="/lottery/prize/prize?status=2">
		                <text>已中奖</text>
		            </navigator>
		            <navigator  :class="['flex-grow-1',data.status==1?'active':'']" openType="redirect" url="/lottery/prize/prize?status=1">
		                <text>未中奖</text>
		            </navigator>
		        </view>
		        <view class="lottery-list" style="padding-bottom:96upx"  v-if="data.list&&data.list.length>0" >
		            <block v-for=" (item,index) in  data.list" :key="index">
		                <view style="height:20upx;"></view>
		                <navigator openType="navigate" :url="'/lottery/goods/goods?id='+item.lottery_id">
		                    <view class="flex-row" style="padding:24upx;border-bottom:1px solid #e2e2e2;background:#ffffff;">
		                        <image class="flex-grow-0" :src="item.gift.cover_pic" style="display:block;width:220upx;height:220upx"></image>
		                        <view class="flex-col" style="padding-left:12pt;font-size:26upx">
		                            <view class="text-more-2" style="">{{item.gift.name}}</view>
		                            <view style="color:#999999;padding-top:36upx">共{{item.lottery.stock}}份</view>
		                        </view>
		                    </view>
		                </navigator>
		                <view class="flex-row flex-y-center" style="color:#999999;height:72upx;padding:0 24upx;background:#ffffff;">
		                    <view class="flex-grow-1 flex-row flex-y-center">
		                        <image src="../../static/lottery/lottery_time.png" style="margin-right:12upx;width:24upx;height:24upx;display:block"></image>
		                        <view>{{item.time}}</view>
		                    </view>
		                    <navigator openType="navigate" :url="'/lottery/detail/detail?id='+item.id">
		                        <view class="flex-grow-0 flex-row flex-y-center flow">
		                            <view>查看详情</view>
		                            <image :src="data.__wxapp_img.dapp.jiantou_r.url"></image>
		                        </view>
		                    </navigator>
		                </view>
		            </block>
		        </view>
		        <view class="no-content" v-else>暂无相关记录</view>
		    </view>
		    <com-naver v-bind="{data:data}"></com-naver>
			<comp-footer v-bind="{data:data}"></comp-footer>
		</view>
		
	</view>
</template>

<script>var myVue = {};
	import comNaver from "../../lottery/commons/naver/naver.vue"
	var is_loading = !1, is_no_more = !0;
	
	export default {
		components:{
			comNaver
		},
		 data(){
			 return {
				 data: {
				     naver: "prize",
				     page: 1
				 },
			 }
		 },
		 onLoad: function(t) {myVue = this;
			  var a = this;
		    a.getApp.page.onLoad(this, t), this.setData({
		        status: t.status || 0
		    });
		   
		    a.getApp.core.showLoading({
		        title: "加载中"
		    }), a.getApp.request({
		        url: a.getApp.api.lottery.prize,
		        data: {
		            status: a.data.status,
		            page: a.data.page
		        },
		        success: function(t) {
		            0 == t.code && (a.setData({
		                list: t.data.list
		            }), null != t.data.list && 0 < t.data.list.length && (is_no_more = !1));
		        },
		        complete: function() {
		            a.getApp.core.hideLoading();
		        }
		    });
		},
		  onReachBottom: function() {
		    is_no_more || this.loadData();
		},
		methods:{
			loadData: function() {
				 var a = this, e = a.data.page + 1;
			    if (!is_loading) {
			        is_loading = !0, a.getApp.core.showLoading({
			            title: "加载中"
			        });
			       
			        a.getApp.request({
			            url: a.getApp.api.lottery.prize,
			            data: {
			                status: a.data.status,
			                page: e
			            },
			            success: function(t) {
			                if (0 == t.code) {
			                    if (null == t.data.list || 0 == t.data.list.length) return void (is_no_more = !0);
			                    a.setData({
			                        list: a.data.list.concat(t.data.list),
			                        page: e
			                    });
			                } else a.showToast({
			                    title: t.msg
			                });
			            },
			            complete: function() {
			                a.getApp.core.hideLoading(), is_loading = !1;
			            }
			        });
			    }
			}
		}
	}
</script>
<style scoped>
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
    border-bottom: 1upx solid #e3e3e3;
    z-index: 999;
}

.top-bar navigator {
    text-align: center;
}

.top-bar navigator text {
    height: 90upx;
    line-height: 90upx;
    border-bottom: 2upx solid transparent;
    width: auto;
    display: inline-block;
}

.top-bar navigator.active text {
    color: #ff4544;
    border-bottom-color: #ff4544;
}

.lottery-list {
    padding-top: 92upx;
}

.flow image {
    width: 20upx;
    height: 30upx;
    margin-left: 16upx;
}

.no-content {
    padding-top: 200upx;
    color: #888;
    text-align: center;
}


.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
    border-bottom: 1upx solid #e3e3e3;
    z-index: 999;
}

.top-bar navigator {
    text-align: center;
}

.top-bar navigator text {
    height: 90upx;
    line-height: 90upx;
    border-bottom: 2upx solid transparent;
    width: auto;
    display: inline-block;
}

.top-bar navigator.active text {
    color: #ff4544;
    border-bottom-color: #ff4544;
}

.lottery-list {
    padding-top: 92upx;
}

.flow image {
    width: 20upx;
    height: 30upx;
    margin-left: 16upx;
}

.no-content {
    padding-top: 200upx;
    color: #888;
    text-align: center;
}
</style>
